
# 获取proto生成的C++代码
file(GLOB_RECURSE PROTO_FILES ${CMAKE_SOURCE_DIR}/tests/*.proto)
set(PROTO_SRC "")
set(PROTO_HEADER "")
foreach(msg ${PROTO_FILES})
    get_filename_component(PREFIX ${msg} NAME_WE)

    list(APPEND PROTO_SRC "${CMAKE_SOURCE_DIR}/tests/${PREFIX}.pb.cc")
    list(APPEND PROTO_HEADER "${CMAKE_SOURCE_DIR}/tests/${PREFIX}.pb.h")
endforeach()


set(
    LIBS 
    ${LIBS} 
    zeroplusmq
    GTest::GTest 
    GTest::Main
)

enable_testing()
find_package(GTest REQUIRED)


add_executable(test_TokenBucket test_TokenBucket.cpp)
target_link_libraries(test_TokenBucket ${LIBS})
gtest_add_tests(TARGET test_TokenBucket)

add_executable(test_Serializer test_Serializer.cpp ${PROTO_SRC})
target_link_libraries(test_Serializer ${LIBS})
gtest_add_tests(TARGET test_Serializer)

add_executable(test_Status test_Status.cpp ${PROTO_SRC})
target_link_libraries(test_Status ${LIBS})
gtest_add_tests(TARGET test_Status)
